/*
 * @lc app=leetcode.cn id=1700 lang=javascript
 *
 * [1700] 无法吃午餐的学生数量
 */

// @lc code=start
/**
 * @param {number[]} students
 * @param {number[]} sandwiches
 * @return {number}
 */
var countStudents = function (students, sandwiches) {
    while(students.length && students.indexOf(sandwiches[0]) !== -1) {
        const stu = students.shift();

        if (stu === sandwiches[0]) {
            sandwiches.shift();
        } else {
            students.push(stu);
        }
    }

    return students.length;
};
// @lc code=end
